/**
 * @desc   运营
 * @param  {String}
 * @return {Boolean} 
 */
/* layout */
import Layout from '../views/layout/Layout';

/* logiLayout */
const logiLayout = resolve => require(['../views/layout/logiLayout'], resolve);


// 运营 —— 空中课堂
const lessonManage = resolve => require(['../views/operation/onlineLesson/lessonManage'], resolve);
const commentDetail = resolve => require(['../views/operation/onlineLesson/commentDetail'], resolve);
const lessonDetail = resolve => require(['../views/operation/onlineLesson/lessonDetail'], resolve);
// 运营-积分商城
const goodsManage = resolve => require(['../views/operation/creditShop/goodsManage'], resolve);
const addGoods = resolve => require(['../views/operation/creditShop/comps/addGoods'], resolve);
const orderManage = resolve => require(['../views/operation/creditShop/orderManage'], resolve);
const orderDetail = resolve => require(['../views/operation/creditShop/comps/orderDetail'], resolve);
const creditSendManage = resolve => require(['../views/operation/creditSendManage/creditSendManage'], resolve);
const creditSend = resolve => require(['../views/operation/creditSendManage/creditSend'], resolve);

//运营-活动管理
const activityManagement = resolve => require(['../views/operation/activityManagement/activityManagement'], resolve);
const addActivity = resolve => require(['../views/operation/activityManagement/addActivity'], resolve);
const editActivity = resolve => require(['../views/operation/activityManagement/editActivity'], resolve);
const activityDetail = resolve => require(['../views/operation/activityManagement/activityDetail'], resolve);

//运营-广告管理
const operation = resolve => require(['../views/operationManagement/AdvMangement/index'], resolve); //广告管理
const parcelMangement = resolve => require(['../views/operationManagement/AdvMangement/comps/parcelMangement'], resolve); //广告统一管理
const getImgState = resolve => require(['../views/operationManagement/AdvMangement/comps/getImgState'], resolve); // 审核
const getAdv = resolve => require(['../views/operationManagement/AdvMangement/comps/getAdv'], resolve); //查看广告


//运营-轮播广告
const CarouselAdvMange = resolve => require(['../views/operation/CarouselAdvMange/index'], resolve); //广告管理
const AdvaddMange = resolve => require(['../views/operation/CarouselAdvMange/comps/AddMangement'], resolve); //添加
const AdveditMange = resolve => require(['../views/operation/CarouselAdvMange/comps/EditMangement'], resolve); //编辑
const getAdvState = resolve => require(['../views/operation/CarouselAdvMange/comps/getImgState'], resolve); // 审核
const getAdvDetail = resolve => require(['../views/operation/CarouselAdvMange/comps/getAdv'], resolve); //查看广告

// 运营-线上辅导-学科辅导
const subjectTutor = resolve => require(['../views/operation/onlineTutor/subjectTutor'], resolve);
const addVideo = resolve => require(['../views/operation/onlineTutor/comps/addVideo'], resolve);
const editVideo = resolve => require(['../views/operation/onlineTutor/comps/editVideo'], resolve);
const videoDetail = resolve => require(['../views/operation/onlineTutor/comps/videoDetail'], resolve);

// 运营-线上辅导-e启学霸
const eStudybug = resolve => require(['../views/operation/eStudybugMange/eStudybug'], resolve);
const addStudybugVideo = resolve => require(['../views/operation/eStudybugMange/comps/addstudybugVideo'], resolve);
const editStudybugVideo = resolve => require(['../views/operation/eStudybugMange/comps/editstudybugVideo'], resolve);
const eStudybugVideoDetail = resolve => require(['../views/operation/eStudybugMange/comps/eStudybugVideoDetail'], resolve);

// 运营-小e

const newsTope = resolve => require(['../views/operation/newsTope/newsTope'], resolve);
const addNewsTope = resolve => require(['../views/operation/newsTope/addNewsTope'], resolve);
const ediNewsTope = resolve => require(['../views/operation/newsTope/ediNewsTope'], resolve);


// 官方动态

const dynamics = resolve => require(['../views/dynamics/dynamics'], resolve);
const addDynamics = resolve => require(['../views/dynamics/addDynamics'], resolve);
const checkDynamics = resolve => require(['../views/dynamics/checkDynamics'], resolve);
const editDynamics = resolve => require(['../views/dynamics/editDynamics'], resolve);

// 商品打包管理
const goodsPackManage = resolve => require(['../views/operation/goodsPackManage/goodsPackManage'], resolve);

// 运营
export const operationRouterMap = [{
        path: '/',
        name: '运营',
        redirect: '/onlineLesson',
        hidden: true,
    },
    {
        path: '/onlineLesson',
        redirect: '/onlineLesson/lessonManage',
        component: Layout,
        name: '空中课堂',
        icon: 'tuozhuai',
        noDropdown: true,
        meta: {
            cache: 'lessonManage, commentDetail'
        },
        children: [
            { path: 'lessonManage', component: lessonManage, name: '空中课堂' },
            { path: 'commentDetail/:lId', component: commentDetail, name: '查看评价' },
            { path: 'lessonDetail/:lId', component: lessonDetail, name: '课程详情' }

        ]
    },
    {
        path: '/creditShop',
        redirect: '/goodsManage/goodsManage',
        component: Layout,
        name: '积分商城',
        icon: 'tubiaoleixingzhengchang',
        noDropdown: false,
        meta: {
            cache: 'goodsManage'
        },
        children: [{
                path: '/goodsManage',
                component: logiLayout,
                redirect: '/goodsManage/goodsManage',
                name: '商品管理',
                noDropdown: true,
                children: [
                    { path: 'goodsManage', component: goodsManage },
                    { path: 'addGoods', component: addGoods, name: '添加商品' },
                    { path: 'ediGoods/:id/:status', component: addGoods, name: '商品编辑' },
                    { path: 'checkGoods/:id/:status', component: addGoods, name: '商品查看' }
                ]
            },
            {
                path: '/orderManage',
                component: logiLayout,
                redirect: '/orderManage/list',
                name: '订单管理',
                noDropdown: true,
                children: [
                    { path: 'list', component: orderManage },
                    { path: 'orderDetail/:id?/:sign?', component: orderDetail, name: '订单详情' }
                ]
            },
        ]
    },
    {
        path: '/creditSendManage',
        redirect: 'creditSendManage/creditSendManage',
        component: Layout,
        name: '积分赠送管理',
        icon: 'zujian',
        noDropdown: true,
        meta: {
            cache: 'creditSendManage'
        },
        children: [
            { path: 'creditSendManage', component: creditSendManage, name: '' },
            { path: 'creditSend', component: creditSend, name: '积分赠送' }
        ]
    },
    // edit by cuihd at 20180720
    // {
    //     path: '/activityManagement',
    //     redirect: '/activityManagement/activityManagement',
    //     name: '活动管理',
    //     component: Layout,
    //     icon: 'zujian',
    //     noDropdown: true,
    //     meta: {
    //         cache: 'activityManagement'
    //     },
    //     children: [
    //         { path: 'activityManagement', component: activityManagement },
    //         { path: 'addActivity', component: addActivity, name: '添加活动' },
    //         { path: 'editActivity/:id?', component: editActivity, name: '编辑活动' },
    //         { path: 'activityDetail/:id?', component: activityDetail, name: '查看活动' }
    //     ]
    // },
    {
        path: '/operation',
        redirect: '/operation/mainList',
        component: Layout,
        name: '广告管理',
        icon: 'tuozhuai',
        noDropdown: true,
        meta: {
            cache: 'operation'
        },
        children: [
            { path: 'mainList', component: operation },
            { path: 'parcelMangement/:state?/:id?', component: parcelMangement, name: '添加广告' },
            { path: 'edilMangement/:state?/:id?', component: parcelMangement, name: '编辑广告' },
            { path: 'getImgState/:id?', component: getImgState, name: '审核广告' },
            { path: 'getAdv/:id?', component: getAdv, name: '查看广告' }
        ]
    },
    {
        path: '/CarouselAdvMange',
        redirect: '/CarouselAdvMange/mainList',
        component: Layout,
        name: '轮播广告',
        icon: 'zonghe',
        noDropdown: true,
        meta: {
            cache: 'CarouselAdvMange'
        },
        children: [
            { path: 'mainList', component: CarouselAdvMange },
            { path: 'AdvparcelMange/:state?/:id?', component: AdvaddMange, name: '添加广告' },
            // { path: 'AdvparcelMange/:state?/:id?', component: AdveditMange, name: '编辑广告' },
            { path: 'getAdvState/:id?', component: getAdvState, name: '审核' },
            { path: 'getAdvDetail/:id?', component: getAdvDetail, name: '查看广告' }
        ]
    },
    {
        path: '/onlineTutor',
        redirect: '/subjectTutor/subjectTutor',
        component: Layout,
        name: '线上辅导',
        icon: 'EXCEL',
        noDropdown: false,
        meta: {
            cache: 'subjectTutor,eStudybug'
        },
        children: [{
                path: '/subjectTutor',
                component: logiLayout,
                redirect: '/subjectTutor/subjectTutor',
                name: '学科辅导',
                noDropdown: true,
                children: [
                    { path: 'subjectTutor', component: subjectTutor },
                    { path: 'addVideo', component: addVideo, name: '添加视频' },
                    { path: 'editVideo/:pid', component: editVideo, name: '编辑视频' },
                    { path: 'videoDetail/:pid', component: videoDetail, name: '视频详情' }
                ]
            },
            // edit by cuihd at 20180720
            // {
            //     path: '/eStudybug',
            //     component: logiLayout,
            //     redirect: '/eStudybug/eStudybug',
            //     name: 'e启学霸',
            //     noDropdown: true,
            //     children: [
            //         { path: 'eStudybug', component: eStudybug },
            //         { path: 'addStudybugVideo', component: addStudybugVideo, name: '添加e启学霸视频' },
            //         { path: 'editStudybugVideo/:pid', component: editStudybugVideo, name: '编辑e启学霸视频' },
            //         { path: 'eStudybugVideoDetail/:pid', component: eStudybugVideoDetail, name: 'e启学霸视频详情' }
            //     ]
            // }
        ]
    },
    {
        path: '/newsTope',
        redirect: '/newsTope/newsTope',
        name: '小e头条',
        component: Layout,
        icon: 'zujian',
        noDropdown: true,
        meta: {
            cache: 'newsTope'
        },
        children: [
            { path: 'newsTope', component: newsTope, name: "小e头条" },
            { path: 'addNewsTope', component: addNewsTope, name: '添加文章' },
            { path: 'ediNewsTope/:pid', component: ediNewsTope, name: '编辑文章' }
        ]
    },
    {
        path: '/dynamics',
        redirect: '/dynamics/dynamics',
        name: '官方动态',
        component: Layout,
        icon: 'tubiaoleixingzhengchang',
        noDropdown: true,
        meta: { cache: 'activationCode' },
        children: [
            { path: 'dynamics', component: dynamics},
            { path: 'addDynamics', component: addDynamics, name: '添加官方动态' },
            { path: 'checkDynamics/:pid', component: checkDynamics, name: '查看官方动态' },
            { path: 'editDynamics/:pid', component: editDynamics, name: '编辑官方动态' },
        ]
    },
    {
        path: '/goodsPackManage',
        redirect: '/goodsPackManage/goodsPackManage',
        name: '商品打包管理',
        component: Layout,
        icon: 'zujian',
        noDropdown: true,
        meta: {
            cache: 'goodsPackManage'
        },
        children: [
            { path: 'goodsPackManage', component: goodsPackManage}
        ]
    }
];

export default operationRouterMap